package com.yxuan.springboot.controller;

import com.yxuan.springboot.service.JobInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.yxuan.springboot.model.JobInformation;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;

/**
 * 
 * @author zchao
 *   JobInformation控制器
 * @date 2023-06-05 13:37:33
 */
@Controller
@Api(tags = "全国职业信息")
@RequestMapping(value = "/jobinformation", method = {RequestMethod.POST,RequestMethod.GET})
@CacheConfig(cacheNames = "jobinformation")//缓存名，和管理器中配置的一致
public class JobInformationController extends BaseController<JobInformation>{

    @Autowired
    private JobInformationService jobInformationService;

    /**
     *  查询职业类别和职业信息
     */
    @ApiOperation(value = "查询职业类别和职业信息", notes = "查询职业类别和职业信息")
    @RequestMapping("/loadAllJob")
    @ResponseBody
    @Cacheable(key = "'loadAllJob'",unless = "#result==null")//#result返回结果
    public ArrayList loadAllJob() throws Exception {
        return jobInformationService.findAllJob();
    }
}
